/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * EMPLOYEE_PROFILE.java
 *
 * Created on Sep 12, 2010, 2:12:25 PM
 */

package Java;

import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author shyan
 */
public class EMPLOYEE_PROFILE extends javax.swing.JFrame {

    private String url = "jdbc:oracle:thin:@localhost:1521:XE";
    private String userID = "HR";
    private String userPW = "hr";
    private Connection con;
    private Statement stmt;
    int temp_count=0;
    int temp_num;

 public EMPLOYEE_PROFILE()
 {
        initComponents();
        setLocationRelativeTo(null);

        search_panel.setVisible(true);
        update_panel.setVisible(false);
        add_panel.setVisible(false);
        delete_panel.setVisible(false);
        L1.setVisible(true);
        L2.setVisible(false);
        L3.setVisible(false);
        L4.setVisible(false);
        L5.setVisible(false);

 }

    EMPLOYEE_PROFILE(String s)
 {
        initComponents();
        setLocationRelativeTo(null);

        search_panel.setVisible(true);
        update_panel.setVisible(false);
        add_panel.setVisible(false);
        delete_panel.setVisible(false);
        L1.setVisible(true);
        L2.setVisible(false);
        L3.setVisible(false);
        L4.setVisible(false);
        L5.setVisible(false);

        {
         String queryString = "SELECT * FROM EMPLOYEE WHERE EMP_ID='"+s+"'";
         System.out.println(queryString);
         ResultSet achieve = getResultSet(queryString);
         try
         {
            if (achieve.next())
            {
                // Display result in a dialog box
                id_field.setText(achieve.getString("EMP_ID"));
                name_field.setText(achieve.getString("EMP_NAME"));
                ic_field.setText(achieve.getString("EMP_IC"));
                phone_field.setText(achieve.getString("EMP_PHONE"));
                email_field.setText(achieve.getString("EMP_EMAIL"));
                address_field.setText(achieve.getString("EMP_ADDRESS"));
                position_field.setText(achieve.getString("EMP_POSITION"));
                String date=achieve.getString("EMP_HIREDATE");
                String year=date.substring(0,4);
                String month=date.substring(5,7);
                String day=date.substring(8,10);
                hiredDate_field.setText(day+" / "+month+" / "+year);
                basicPay_field.setText(achieve.getString("EMP_PAY"));
                password_field.setText(achieve.getString("EMP_PW"));
                race_field.setText(achieve.getString("EMP_RACE"));
                religion_field.setText(achieve.getString("EMP_RELIGION"));
                status_field.setText(achieve.getString("EMP_STATUS"));


                id_field.setFocusable(false);
                name_field.setFocusable(false);
                ic_field.setFocusable(false);
                phone_field.setFocusable(false);
                email_field.setFocusable(false);
                address_field.setFocusable(false);
                position_field.setFocusable(false);
                hiredDate_field.setFocusable(false);
                basicPay_field.setFocusable(false);
                password_field.setFocusable(false);
                race_field.setFocusable(false);
                religion_field.setFocusable(false);
                status_field.setFocusable(false);
            }
        }
        catch (SQLException ex)
        {
            ex.printStackTrace();
        }
    }
    }


    //***************************** DATEBASE CONNECTION PART ******************************
    private void connectDatabase()
    {
        try
        {
            Class.forName("oracle.jdbc.OracleDriver");
            con=DriverManager.getConnection(url, userID, userPW);
        }

        catch (ClassNotFoundException ex)
        {
            Logger.getLogger(EMPLOYEE_PROFILE.class.getName()).log(Level.SEVERE, null, ex);
        }        catch (SQLException ex)
        {
            Logger.getLogger(EMPLOYEE_PROFILE.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    //***************************** DATEBASE EXECUTE PART ******************************
    private ResultSet getResultSet(String doubt)
    {
        connectDatabase();
        ResultSet outcome = null;
        try
        {
            stmt = con.createStatement();
            outcome = stmt.executeQuery(doubt);
        }
        catch (SQLException ex)
        {
            Logger.getLogger(EMPLOYEE_PROFILE.class.getName()).log(Level.SEVERE, null, ex);
        }
        return outcome;
    }
    
    //***************************** DATEBASE UPDATE PART ******************************
    private void updateRow(String edit)
    {
        connectDatabase();
        try
        {
            stmt = con.createStatement();
            stmt.executeUpdate(edit);
        }
        catch (SQLException ex)
        {
            Logger.getLogger(EMPLOYEE_PROFILE.class.getName()).log(Level.SEVERE, null, ex);
        }

    }



    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLayeredPane1 = new javax.swing.JLayeredPane();
        jSeparator1 = new javax.swing.JSeparator();
        title = new javax.swing.JLabel();
        option_panel = new javax.swing.JPanel();
        add_button = new javax.swing.JButton();
        search_button = new javax.swing.JButton();
        update_button = new javax.swing.JButton();
        delete_button = new javax.swing.JButton();
        view_button = new javax.swing.JButton();
        search = new javax.swing.JLabel();
        update = new javax.swing.JLabel();
        add = new javax.swing.JLabel();
        delete = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        L1 = new javax.swing.JLabel();
        L2 = new javax.swing.JLabel();
        L3 = new javax.swing.JLabel();
        L4 = new javax.swing.JLabel();
        L5 = new javax.swing.JLabel();
        Background = new javax.swing.JLabel();
        search_panel = new javax.swing.JPanel();
        selection = new javax.swing.JComboBox();
        find_field = new javax.swing.JTextField();
        jSeparator2 = new javax.swing.JSeparator();
        id = new javax.swing.JLabel();
        name = new javax.swing.JLabel();
        race = new javax.swing.JLabel();
        ic = new javax.swing.JLabel();
        religion = new javax.swing.JLabel();
        phone = new javax.swing.JLabel();
        status = new javax.swing.JLabel();
        email = new javax.swing.JLabel();
        address = new javax.swing.JLabel();
        position = new javax.swing.JLabel();
        hiredDate = new javax.swing.JLabel();
        name_field = new javax.swing.JTextField();
        race_field = new javax.swing.JTextField();
        ic_field = new javax.swing.JTextField();
        religion_field = new javax.swing.JTextField();
        phone_field = new javax.swing.JTextField();
        status_field = new javax.swing.JTextField();
        email_field = new javax.swing.JTextField();
        address_field = new javax.swing.JTextField();
        position_field = new javax.swing.JTextField();
        hiredDate_field = new javax.swing.JTextField();
        basicPay_field = new javax.swing.JTextField();
        password_field = new javax.swing.JTextField();
        back_button3 = new javax.swing.JButton();
        id_field = new javax.swing.JLabel();
        password = new javax.swing.JLabel();
        basicPay = new javax.swing.JLabel();
        find_button = new javax.swing.JButton();
        reset_button = new javax.swing.JButton();
        BackgroundSearch = new javax.swing.JLabel();
        update_panel = new javax.swing.JPanel();
        selection1 = new javax.swing.JComboBox();
        find_field1 = new javax.swing.JTextField();
        find_button1 = new javax.swing.JButton();
        reset_button1 = new javax.swing.JButton();
        jSeparator3 = new javax.swing.JSeparator();
        id1 = new javax.swing.JLabel();
        name1 = new javax.swing.JLabel();
        ic1 = new javax.swing.JLabel();
        phone1 = new javax.swing.JLabel();
        email1 = new javax.swing.JLabel();
        address1 = new javax.swing.JLabel();
        position1 = new javax.swing.JLabel();
        hiredDate1 = new javax.swing.JLabel();
        basicPay1 = new javax.swing.JLabel();
        password1 = new javax.swing.JLabel();
        name_field1 = new javax.swing.JTextField();
        ic_field1 = new javax.swing.JTextField();
        phone_field1 = new javax.swing.JTextField();
        email_field1 = new javax.swing.JTextField();
        address_field1 = new javax.swing.JTextField();
        basicPay_field1 = new javax.swing.JTextField();
        password_field1 = new javax.swing.JTextField();
        saveUPDATE = new javax.swing.JButton();
        raceBox = new javax.swing.JComboBox();
        religionBox = new javax.swing.JComboBox();
        statusBox = new javax.swing.JComboBox();
        positionBox = new javax.swing.JComboBox();
        dayBox = new javax.swing.JComboBox();
        monthBox = new javax.swing.JComboBox();
        yearBox = new javax.swing.JComboBox();
        back_button2 = new javax.swing.JButton();
        race1 = new javax.swing.JLabel();
        religion1 = new javax.swing.JLabel();
        status1 = new javax.swing.JLabel();
        id_field1 = new javax.swing.JLabel();
        Wallpaper2 = new javax.swing.JLabel();
        add_panel = new javax.swing.JPanel();
        jSeparator4 = new javax.swing.JSeparator();
        id2 = new javax.swing.JLabel();
        name2 = new javax.swing.JLabel();
        ic2 = new javax.swing.JLabel();
        phone2 = new javax.swing.JLabel();
        email2 = new javax.swing.JLabel();
        address2 = new javax.swing.JLabel();
        position2 = new javax.swing.JLabel();
        hiredDate2 = new javax.swing.JLabel();
        basicPay2 = new javax.swing.JLabel();
        password2 = new javax.swing.JLabel();
        name_field2 = new javax.swing.JTextField();
        ic_field2 = new javax.swing.JTextField();
        phone_field2 = new javax.swing.JTextField();
        email_field2 = new javax.swing.JTextField();
        address_field2 = new javax.swing.JTextField();
        basicPay_field2 = new javax.swing.JTextField();
        password_field2 = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        AddProfile = new javax.swing.JButton();
        positionBox2 = new javax.swing.JComboBox();
        dayBox2 = new javax.swing.JComboBox();
        monthBox2 = new javax.swing.JComboBox();
        yearBox2 = new javax.swing.JComboBox();
        reset_button2 = new javax.swing.JButton();
        back_button4 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        race2 = new javax.swing.JLabel();
        religion2 = new javax.swing.JLabel();
        status2 = new javax.swing.JLabel();
        raceBox2 = new javax.swing.JComboBox();
        religionBox2 = new javax.swing.JComboBox();
        statusBox2 = new javax.swing.JComboBox();
        id_field2 = new javax.swing.JLabel();
        Wallpaper3 = new javax.swing.JLabel();
        delete_panel = new javax.swing.JPanel();
        selection3 = new javax.swing.JComboBox();
        find_field3 = new javax.swing.JTextField();
        find_button3 = new javax.swing.JButton();
        reset_button3 = new javax.swing.JButton();
        jSeparator5 = new javax.swing.JSeparator();
        id3 = new javax.swing.JLabel();
        name3 = new javax.swing.JLabel();
        ic3 = new javax.swing.JLabel();
        phone3 = new javax.swing.JLabel();
        email3 = new javax.swing.JLabel();
        address3 = new javax.swing.JLabel();
        position3 = new javax.swing.JLabel();
        hiredDate3 = new javax.swing.JLabel();
        basicPay3 = new javax.swing.JLabel();
        password3 = new javax.swing.JLabel();
        name_field3 = new javax.swing.JTextField();
        ic_field3 = new javax.swing.JTextField();
        phone_field3 = new javax.swing.JTextField();
        email_field3 = new javax.swing.JTextField();
        address_field3 = new javax.swing.JTextField();
        position_field3 = new javax.swing.JTextField();
        hiredDate_field3 = new javax.swing.JTextField();
        basicPay_field3 = new javax.swing.JTextField();
        password_field3 = new javax.swing.JTextField();
        DELETE_BUTTON = new javax.swing.JButton();
        back_button5 = new javax.swing.JButton();
        race3 = new javax.swing.JLabel();
        religion3 = new javax.swing.JLabel();
        status3 = new javax.swing.JLabel();
        race_field3 = new javax.swing.JTextField();
        religion_field3 = new javax.swing.JTextField();
        status_field3 = new javax.swing.JTextField();
        id_field3 = new javax.swing.JLabel();
        wallpaper4 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(700, 500));
        setResizable(false);

        jLayeredPane1.setBackground(new java.awt.Color(255, 255, 102));
        jLayeredPane1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 204, 255), 4, true));
        jLayeredPane1.setMinimumSize(new java.awt.Dimension(700, 500));
        jSeparator1.setBounds(0, 70, 690, 10);
        jLayeredPane1.add(jSeparator1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        title.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 24));
        title.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        title.setText("EMPLOYEE  PROFILE");
        title.setBounds(40, 20, 260, 40);
        jLayeredPane1.add(title, javax.swing.JLayeredPane.DEFAULT_LAYER);

        option_panel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "OPTION", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tw Cen MT Condensed", 0, 18))); // NOI18N
        option_panel.setLayout(null);

        add_button.setFont(new java.awt.Font("Tw Cen MT Condensed", 0, 14));
        add_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/add2.png"))); // NOI18N
        add_button.setMaximumSize(new java.awt.Dimension(51, 51));
        add_button.setMinimumSize(new java.awt.Dimension(51, 51));
        add_button.setPreferredSize(new java.awt.Dimension(51, 51));
        add_button.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                add_buttonMouseClicked(evt);
            }
        });
        add_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                add_buttonActionPerformed(evt);
            }
        });
        option_panel.add(add_button);
        add_button.setBounds(20, 170, 40, 40);

        search_button.setFont(new java.awt.Font("Tw Cen MT Condensed", 0, 14));
        search_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/search2.png"))); // NOI18N
        search_button.setMaximumSize(new java.awt.Dimension(51, 51));
        search_button.setMinimumSize(new java.awt.Dimension(51, 51));
        search_button.setPreferredSize(new java.awt.Dimension(51, 51));
        search_button.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                search_buttonMouseClicked(evt);
            }
        });
        search_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                search_buttonActionPerformed(evt);
            }
        });
        option_panel.add(search_button);
        search_button.setBounds(20, 30, 40, 40);

        update_button.setFont(new java.awt.Font("Tw Cen MT Condensed", 0, 14));
        update_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/update2.png"))); // NOI18N
        update_button.setMaximumSize(new java.awt.Dimension(51, 51));
        update_button.setMinimumSize(new java.awt.Dimension(51, 51));
        update_button.setPreferredSize(new java.awt.Dimension(51, 51));
        update_button.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                update_buttonMouseClicked(evt);
            }
        });
        update_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                update_buttonActionPerformed(evt);
            }
        });
        option_panel.add(update_button);
        update_button.setBounds(20, 100, 40, 40);

        delete_button.setFont(new java.awt.Font("Tw Cen MT Condensed", 0, 14));
        delete_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/dalete2.png"))); // NOI18N
        delete_button.setMaximumSize(new java.awt.Dimension(51, 51));
        delete_button.setMinimumSize(new java.awt.Dimension(51, 51));
        delete_button.setPreferredSize(new java.awt.Dimension(51, 51));
        delete_button.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                delete_buttonMouseClicked(evt);
            }
        });
        delete_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                delete_buttonActionPerformed(evt);
            }
        });
        option_panel.add(delete_button);
        delete_button.setBounds(20, 240, 40, 40);

        view_button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/view2.png"))); // NOI18N
        view_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                view_buttonActionPerformed(evt);
            }
        });
        option_panel.add(view_button);
        view_button.setBounds(20, 310, 40, 40);

        search.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 12));
        search.setText("SEARCH");
        option_panel.add(search);
        search.setBounds(60, 40, 48, 10);

        update.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 12));
        update.setText("UPDATE");
        option_panel.add(update);
        update.setBounds(60, 110, 57, 14);

        add.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 12));
        add.setText("ADD");
        option_panel.add(add);
        add.setBounds(60, 180, 26, 14);

        delete.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 12));
        delete.setText("DELETE");
        option_panel.add(delete);
        delete.setBounds(60, 250, 47, 14);

        jLabel4.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 12));
        jLabel4.setText("VIEW");
        option_panel.add(jLabel4);
        jLabel4.setBounds(60, 320, 31, 14);

        L1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        option_panel.add(L1);
        L1.setBounds(10, 20, 110, 60);

        L2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        option_panel.add(L2);
        L2.setBounds(10, 90, 110, 60);

        L3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        option_panel.add(L3);
        L3.setBounds(10, 160, 110, 60);

        L4.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        option_panel.add(L4);
        L4.setBounds(10, 230, 110, 60);

        L5.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        option_panel.add(L5);
        L5.setBounds(10, 300, 110, 60);

        Background.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        Background.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/abstract_0072.jpg"))); // NOI18N
        Background.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "OPTION", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("DejaVu Serif Condensed", 0, 18))); // NOI18N
        option_panel.add(Background);
        Background.setBounds(0, 0, 130, 380);

        option_panel.setBounds(20, 90, 130, 380);
        jLayeredPane1.add(option_panel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        search_panel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "SEARCH", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("DejaVu Serif Condensed", 0, 18))); // NOI18N
        search_panel.setLayout(null);

        selection.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14)); // NOI18N
        selection.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ID", "IC" }));
        search_panel.add(selection);
        selection.setBounds(16, 23, 62, 26);

        find_field.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        search_panel.add(find_field);
        find_field.setBounds(98, 24, 130, 26);
        search_panel.add(jSeparator2);
        jSeparator2.setBounds(16, 59, 480, 10);

        id.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14)); // NOI18N
        id.setText("Code ID :");
        search_panel.add(id);
        id.setBounds(16, 70, 80, 16);

        name.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        name.setText("Name  :");
        name.setMaximumSize(new java.awt.Dimension(44, 18));
        name.setMinimumSize(new java.awt.Dimension(44, 18));
        search_panel.add(name);
        name.setBounds(16, 101, 60, 16);

        race.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        race.setText("Race  :");
        search_panel.add(race);
        race.setBounds(340, 100, 80, 20);

        ic.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        ic.setText("IC no. :");
        search_panel.add(ic);
        ic.setBounds(16, 132, 68, 16);

        religion.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14)); // NOI18N
        religion.setText("Religion :");
        search_panel.add(religion);
        religion.setBounds(340, 130, 80, 16);

        phone.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        phone.setText("Phone no. :");
        search_panel.add(phone);
        phone.setBounds(16, 163, 100, 16);

        status.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        status.setText("Status  :");
        search_panel.add(status);
        status.setBounds(340, 160, 70, 16);

        email.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        email.setText("Email   :");
        search_panel.add(email);
        email.setBounds(16, 194, 68, 16);

        address.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        address.setText("Address :");
        search_panel.add(address);
        address.setBounds(16, 225, 68, 16);

        position.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        position.setText("Position  :");
        search_panel.add(position);
        position.setBounds(16, 256, 68, 16);

        hiredDate.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        hiredDate.setText("Hired Date :");
        search_panel.add(hiredDate);
        hiredDate.setBounds(16, 287, 80, 16);

        name_field.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        search_panel.add(name_field);
        name_field.setBounds(100, 100, 132, 26);

        race_field.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        search_panel.add(race_field);
        race_field.setBounds(410, 100, 90, 26);

        ic_field.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        search_panel.add(ic_field);
        ic_field.setBounds(100, 130, 132, 26);

        religion_field.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        search_panel.add(religion_field);
        religion_field.setBounds(410, 130, 90, 26);

        phone_field.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        search_panel.add(phone_field);
        phone_field.setBounds(100, 160, 132, 26);

        status_field.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        search_panel.add(status_field);
        status_field.setBounds(410, 160, 90, 26);

        email_field.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        search_panel.add(email_field);
        email_field.setBounds(100, 190, 210, 26);

        address_field.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        search_panel.add(address_field);
        address_field.setBounds(100, 220, 400, 26);

        position_field.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        search_panel.add(position_field);
        position_field.setBounds(100, 250, 131, 26);

        hiredDate_field.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        search_panel.add(hiredDate_field);
        hiredDate_field.setBounds(100, 280, 131, 26);

        basicPay_field.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        search_panel.add(basicPay_field);
        basicPay_field.setBounds(100, 310, 131, 26);

        password_field.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        search_panel.add(password_field);
        password_field.setBounds(100, 340, 131, 26);

        back_button3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 13)); // NOI18N
        back_button3.setText("BACK");
        back_button3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                back_button3ActionPerformed(evt);
            }
        });
        search_panel.add(back_button3);
        back_button3.setBounds(420, 340, 80, 30);

        id_field.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        id_field.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
        search_panel.add(id_field);
        id_field.setBounds(100, 70, 130, 20);

        password.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        password.setText("Password   :");
        search_panel.add(password);
        password.setBounds(20, 340, 90, 20);

        basicPay.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        basicPay.setText("Basic Pay   :");
        search_panel.add(basicPay);
        basicPay.setBounds(20, 316, 80, 16);

        find_button.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 13)); // NOI18N
        find_button.setText("FIND");
        find_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                find_buttonActionPerformed(evt);
            }
        });
        search_panel.add(find_button);
        find_button.setBounds(240, 20, 80, 30);

        reset_button.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 13)); // NOI18N
        reset_button.setText("RESET");
        reset_button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                reset_buttonActionPerformed(evt);
            }
        });
        search_panel.add(reset_button);
        reset_button.setBounds(330, 20, 80, 30);

        BackgroundSearch.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 18)); // NOI18N
        BackgroundSearch.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        BackgroundSearch.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/abstract_0072.jpg"))); // NOI18N
        BackgroundSearch.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "SEARCH", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("DejaVu Serif Condensed", 0, 18))); // NOI18N
        search_panel.add(BackgroundSearch);
        BackgroundSearch.setBounds(0, 0, 520, 380);

        search_panel.setBounds(160, 90, 520, 380);
        jLayeredPane1.add(search_panel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        update_panel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "UPDATE", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("DejaVu Serif Condensed", 0, 18))); // NOI18N
        update_panel.setMinimumSize(new java.awt.Dimension(510, 380));
        update_panel.setLayout(null);

        selection1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        selection1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ID", "IC" }));
        update_panel.add(selection1);
        selection1.setBounds(16, 23, 62, 26);

        find_field1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        update_panel.add(find_field1);
        find_field1.setBounds(100, 26, 131, 26);

        find_button1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        find_button1.setText("FIND");
        find_button1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                find_button1ActionPerformed(evt);
            }
        });
        update_panel.add(find_button1);
        find_button1.setBounds(240, 22, 80, 28);

        reset_button1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        reset_button1.setText("RESET");
        reset_button1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                reset_button1ActionPerformed(evt);
            }
        });
        update_panel.add(reset_button1);
        reset_button1.setBounds(330, 22, 80, 28);
        update_panel.add(jSeparator3);
        jSeparator3.setBounds(16, 61, 480, 6);

        id1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        id1.setText("Code ID :");
        update_panel.add(id1);
        id1.setBounds(16, 70, 68, 16);

        name1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        name1.setText("Name  :");
        update_panel.add(name1);
        name1.setBounds(16, 101, 68, 16);

        ic1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        ic1.setText("IC no. :");
        update_panel.add(ic1);
        ic1.setBounds(16, 132, 68, 16);

        phone1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        phone1.setText("Phone no. :");
        update_panel.add(phone1);
        phone1.setBounds(16, 163, 80, 16);

        email1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        email1.setText("Email   :");
        update_panel.add(email1);
        email1.setBounds(16, 194, 68, 16);

        address1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        address1.setText("Address :");
        update_panel.add(address1);
        address1.setBounds(16, 225, 68, 16);

        position1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        position1.setText("Position  :");
        update_panel.add(position1);
        position1.setBounds(16, 256, 68, 16);

        hiredDate1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        hiredDate1.setText("Hired Date :");
        update_panel.add(hiredDate1);
        hiredDate1.setBounds(16, 287, 80, 20);

        basicPay1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        basicPay1.setText("Basic Pay   :");
        update_panel.add(basicPay1);
        basicPay1.setBounds(20, 320, 80, 20);

        password1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        password1.setText("Password   :");
        update_panel.add(password1);
        password1.setBounds(20, 350, 80, 20);

        name_field1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        update_panel.add(name_field1);
        name_field1.setBounds(100, 100, 132, 26);

        ic_field1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        update_panel.add(ic_field1);
        ic_field1.setBounds(100, 130, 132, 26);

        phone_field1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        update_panel.add(phone_field1);
        phone_field1.setBounds(100, 160, 132, 26);

        email_field1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        update_panel.add(email_field1);
        email_field1.setBounds(98, 194, 200, 26);

        address_field1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        update_panel.add(address_field1);
        address_field1.setBounds(100, 226, 400, 26);

        basicPay_field1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        update_panel.add(basicPay_field1);
        basicPay_field1.setBounds(100, 314, 131, 26);

        password_field1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        update_panel.add(password_field1);
        password_field1.setBounds(100, 346, 131, 26);

        saveUPDATE.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        saveUPDATE.setText("SAVE");
        saveUPDATE.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saveUPDATEActionPerformed(evt);
            }
        });
        update_panel.add(saveUPDATE);
        saveUPDATE.setBounds(350, 340, 70, 30);

        raceBox.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        raceBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Chinese", "Indian", "Malay", "Other" }));
        update_panel.add(raceBox);
        raceBox.setBounds(410, 100, 90, 20);

        religionBox.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        religionBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Buddha", "Islam", "Hindu", "Other" }));
        update_panel.add(religionBox);
        religionBox.setBounds(410, 130, 90, 20);

        statusBox.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        statusBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Single", "Married" }));
        update_panel.add(statusBox);
        statusBox.setBounds(410, 160, 90, 20);

        positionBox.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        positionBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Manager", "Supervisor", "Accountant", "Cashier", "Staff" }));
        update_panel.add(positionBox);
        positionBox.setBounds(100, 260, 130, 20);

        dayBox.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        dayBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
        update_panel.add(dayBox);
        dayBox.setBounds(100, 290, 60, 20);

        monthBox.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        monthBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec" }));
        update_panel.add(monthBox);
        monthBox.setBounds(170, 290, 60, 20);

        yearBox.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        yearBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020" }));
        update_panel.add(yearBox);
        yearBox.setBounds(240, 290, 70, 20);

        back_button2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 13));
        back_button2.setText("BACK");
        back_button2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                back_button2ActionPerformed(evt);
            }
        });
        update_panel.add(back_button2);
        back_button2.setBounds(430, 340, 70, 30);

        race1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        race1.setText("Race  :");
        update_panel.add(race1);
        race1.setBounds(340, 100, 68, 16);

        religion1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        religion1.setText("Religion  :");
        update_panel.add(religion1);
        religion1.setBounds(340, 130, 68, 16);

        status1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        status1.setText("Status  :");
        update_panel.add(status1);
        status1.setBounds(340, 160, 68, 20);

        id_field1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        id_field1.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
        update_panel.add(id_field1);
        id_field1.setBounds(100, 70, 130, 20);

        Wallpaper2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        Wallpaper2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/abstract_0072.jpg"))); // NOI18N
        Wallpaper2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "UPDATE", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("DejaVu Serif Condensed", 0, 18))); // NOI18N
        update_panel.add(Wallpaper2);
        Wallpaper2.setBounds(0, 0, 520, 380);

        update_panel.setBounds(160, 90, 520, 380);
        jLayeredPane1.add(update_panel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        add_panel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "ADD", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tw Cen MT Condensed", 0, 18))); // NOI18N
        add_panel.setPreferredSize(new java.awt.Dimension(510, 380));
        add_panel.setLayout(null);
        add_panel.add(jSeparator4);
        jSeparator4.setBounds(16, 57, 490, 10);

        id2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        id2.setText("*Code ID :");
        add_panel.add(id2);
        id2.setBounds(16, 70, 68, 16);

        name2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        name2.setText("*Name  :");
        add_panel.add(name2);
        name2.setBounds(16, 101, 68, 16);

        ic2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        ic2.setText("*IC no. :");
        add_panel.add(ic2);
        ic2.setBounds(16, 132, 68, 16);

        phone2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        phone2.setText("*Phone no. :");
        add_panel.add(phone2);
        phone2.setBounds(16, 163, 90, 16);

        email2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        email2.setText("*Email :");
        add_panel.add(email2);
        email2.setBounds(16, 194, 68, 16);

        address2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        address2.setText("*Address :");
        add_panel.add(address2);
        address2.setBounds(16, 225, 68, 16);

        position2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        position2.setText("*Position  :");
        add_panel.add(position2);
        position2.setBounds(16, 256, 80, 16);

        hiredDate2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        hiredDate2.setText("*Hired Date :");
        add_panel.add(hiredDate2);
        hiredDate2.setBounds(16, 287, 90, 16);

        basicPay2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        basicPay2.setText("*Basic Pay   :");
        add_panel.add(basicPay2);
        basicPay2.setBounds(16, 318, 90, 20);

        password2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        password2.setText("*Password   :");
        add_panel.add(password2);
        password2.setBounds(16, 349, 83, 20);

        name_field2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        add_panel.add(name_field2);
        name_field2.setBounds(100, 100, 132, 26);

        ic_field2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        add_panel.add(ic_field2);
        ic_field2.setBounds(100, 130, 132, 26);

        phone_field2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        add_panel.add(phone_field2);
        phone_field2.setBounds(100, 160, 132, 26);
        add_panel.add(email_field2);
        email_field2.setBounds(100, 190, 200, 25);

        address_field2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        add_panel.add(address_field2);
        address_field2.setBounds(100, 220, 400, 26);

        basicPay_field2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        add_panel.add(basicPay_field2);
        basicPay_field2.setBounds(100, 320, 131, 26);

        password_field2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        password_field2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseExited(java.awt.event.MouseEvent evt) {
                password_field2MouseExited(evt);
            }
        });
        password_field2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                password_field2ActionPerformed(evt);
            }
        });
        password_field2.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                password_field2KeyTyped(evt);
            }
        });
        add_panel.add(password_field2);
        password_field2.setBounds(100, 350, 131, 26);

        jLabel2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel2.setText("New Profile");
        jLabel2.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED, null, null, new java.awt.Color(204, 204, 255), new java.awt.Color(204, 204, 204)));
        add_panel.add(jLabel2);
        jLabel2.setBounds(180, 20, 150, 30);

        AddProfile.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 13));
        AddProfile.setText("ADD");
        AddProfile.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                AddProfileActionPerformed(evt);
            }
        });
        add_panel.add(AddProfile);
        AddProfile.setBounds(350, 340, 70, 30);

        positionBox2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        positionBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Staff", "Supervisor", "Manager" }));
        add_panel.add(positionBox2);
        positionBox2.setBounds(100, 256, 130, 20);

        dayBox2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        dayBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
        add_panel.add(dayBox2);
        dayBox2.setBounds(103, 290, 52, 20);

        monthBox2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        monthBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sep", "Oct", "Nov", "Dec" }));
        add_panel.add(monthBox2);
        monthBox2.setBounds(170, 290, 60, 20);

        yearBox2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        yearBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020" }));
        add_panel.add(yearBox2);
        yearBox2.setBounds(240, 290, 70, 20);

        reset_button2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 13));
        reset_button2.setText("RESET");
        reset_button2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                reset_button2ActionPerformed(evt);
            }
        });
        add_panel.add(reset_button2);
        reset_button2.setBounds(240, 70, 80, 20);

        back_button4.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 13));
        back_button4.setText("BACK");
        back_button4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                back_button4ActionPerformed(evt);
            }
        });
        add_panel.add(back_button4);
        back_button4.setBounds(430, 340, 70, 30);

        jLabel1.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        jLabel1.setText("*  Required Fill  ");
        add_panel.add(jLabel1);
        jLabel1.setBounds(390, 20, 110, 30);

        race2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        race2.setText("Race :");
        add_panel.add(race2);
        race2.setBounds(340, 100, 68, 20);

        religion2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        religion2.setText("Religion  :");
        add_panel.add(religion2);
        religion2.setBounds(340, 130, 68, 20);

        status2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        status2.setText("Status  :");
        add_panel.add(status2);
        status2.setBounds(340, 160, 68, 20);

        raceBox2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        raceBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Chinese", "Indian", "Malay", "Other" }));
        add_panel.add(raceBox2);
        raceBox2.setBounds(410, 100, 90, 20);

        religionBox2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        religionBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Buddha", "Islam", "Hindu", "Other" }));
        add_panel.add(religionBox2);
        religionBox2.setBounds(410, 130, 90, 20);

        statusBox2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        statusBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Single", "Married" }));
        add_panel.add(statusBox2);
        statusBox2.setBounds(410, 160, 90, 20);

        id_field2.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        id_field2.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
        add_panel.add(id_field2);
        id_field2.setBounds(100, 70, 130, 20);

        Wallpaper3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        Wallpaper3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/abstract_0072.jpg"))); // NOI18N
        Wallpaper3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "ADD", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("DejaVu Serif Condensed", 0, 18))); // NOI18N
        add_panel.add(Wallpaper3);
        Wallpaper3.setBounds(0, 0, 520, 380);

        add_panel.setBounds(160, 90, 520, 380);
        jLayeredPane1.add(add_panel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        delete_panel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "DELETE", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("DejaVu Serif Condensed", 0, 18))); // NOI18N
        delete_panel.setMinimumSize(new java.awt.Dimension(510, 380));
        delete_panel.setLayout(null);

        selection3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        selection3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "ID", "Name" }));
        delete_panel.add(selection3);
        selection3.setBounds(16, 23, 70, 30);

        find_field3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        delete_panel.add(find_field3);
        find_field3.setBounds(100, 22, 131, 30);

        find_button3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 13));
        find_button3.setText("FIND");
        find_button3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                find_button3ActionPerformed(evt);
            }
        });
        delete_panel.add(find_button3);
        find_button3.setBounds(240, 20, 80, 30);

        reset_button3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 13));
        reset_button3.setText("RESET");
        reset_button3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                reset_button3ActionPerformed(evt);
            }
        });
        delete_panel.add(reset_button3);
        reset_button3.setBounds(330, 20, 80, 30);
        delete_panel.add(jSeparator5);
        jSeparator5.setBounds(16, 57, 490, 6);

        id3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        id3.setText("Code ID :");
        delete_panel.add(id3);
        id3.setBounds(16, 70, 68, 16);

        name3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        name3.setText("Name  :");
        delete_panel.add(name3);
        name3.setBounds(16, 101, 68, 16);

        ic3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        ic3.setText("IC no. :");
        delete_panel.add(ic3);
        ic3.setBounds(16, 132, 68, 16);

        phone3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        phone3.setText("Phone no. :");
        delete_panel.add(phone3);
        phone3.setBounds(16, 163, 80, 16);

        email3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        email3.setText("Email   :");
        delete_panel.add(email3);
        email3.setBounds(16, 194, 68, 16);

        address3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        address3.setText("Address :");
        delete_panel.add(address3);
        address3.setBounds(16, 225, 68, 16);

        position3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        position3.setText("Position  :");
        delete_panel.add(position3);
        position3.setBounds(16, 256, 68, 16);

        hiredDate3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        hiredDate3.setText("Hired Date :");
        delete_panel.add(hiredDate3);
        hiredDate3.setBounds(16, 287, 80, 16);

        basicPay3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        basicPay3.setText("Basic Pay   :");
        delete_panel.add(basicPay3);
        basicPay3.setBounds(16, 318, 90, 20);

        password3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        password3.setText("Password   :");
        delete_panel.add(password3);
        password3.setBounds(16, 349, 80, 20);

        name_field3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        delete_panel.add(name_field3);
        name_field3.setBounds(100, 100, 132, 26);

        ic_field3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        delete_panel.add(ic_field3);
        ic_field3.setBounds(100, 130, 132, 26);

        phone_field3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        delete_panel.add(phone_field3);
        phone_field3.setBounds(100, 160, 132, 26);

        email_field3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        delete_panel.add(email_field3);
        email_field3.setBounds(100, 190, 210, 26);

        address_field3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        delete_panel.add(address_field3);
        address_field3.setBounds(100, 220, 400, 26);

        position_field3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        delete_panel.add(position_field3);
        position_field3.setBounds(100, 250, 131, 26);

        hiredDate_field3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        delete_panel.add(hiredDate_field3);
        hiredDate_field3.setBounds(100, 286, 131, 26);

        basicPay_field3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        delete_panel.add(basicPay_field3);
        basicPay_field3.setBounds(100, 320, 131, 26);

        password_field3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        delete_panel.add(password_field3);
        password_field3.setBounds(100, 350, 131, 26);

        DELETE_BUTTON.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 12));
        DELETE_BUTTON.setText("DELETE");
        DELETE_BUTTON.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DELETE_BUTTONActionPerformed(evt);
            }
        });
        delete_panel.add(DELETE_BUTTON);
        DELETE_BUTTON.setBounds(340, 340, 80, 30);

        back_button5.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 13));
        back_button5.setText("BACK");
        back_button5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                back_button5ActionPerformed(evt);
            }
        });
        delete_panel.add(back_button5);
        back_button5.setBounds(430, 340, 70, 30);

        race3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        race3.setText("Race  :");
        delete_panel.add(race3);
        race3.setBounds(340, 100, 68, 16);

        religion3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        religion3.setText("Religion  :");
        delete_panel.add(religion3);
        religion3.setBounds(340, 130, 68, 16);

        status3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        status3.setText("Status  :");
        delete_panel.add(status3);
        status3.setBounds(340, 160, 68, 16);

        race_field3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        delete_panel.add(race_field3);
        race_field3.setBounds(410, 100, 90, 26);

        religion_field3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        delete_panel.add(religion_field3);
        religion_field3.setBounds(410, 130, 90, 26);

        status_field3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        delete_panel.add(status_field3);
        status_field3.setBounds(410, 160, 90, 26);

        id_field3.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 14));
        id_field3.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
        delete_panel.add(id_field3);
        id_field3.setBounds(100, 70, 130, 20);

        wallpaper4.setFont(new java.awt.Font("DejaVu Serif Condensed", 0, 13));
        wallpaper4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        wallpaper4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/abstract_0072.jpg"))); // NOI18N
        wallpaper4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "DELETE", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("DejaVu Serif Condensed", 0, 18))); // NOI18N
        delete_panel.add(wallpaper4);
        wallpaper4.setBounds(0, 0, 520, 380);

        delete_panel.setBounds(160, 90, 520, 380);
        jLayeredPane1.add(delete_panel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Image/ZzZzZzZ.jpg"))); // NOI18N
        jLabel3.setBounds(0, 0, 700, 500);
        jLayeredPane1.add(jLabel3, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 700, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 500, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents



    //************************** USER SEARCH PART ******************************
    private void find_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_find_buttonActionPerformed
    
        String field = find_field.getText();
        String choice = selection.getSelectedItem().toString();
        String queryString;
        String Dateformat;
        if (choice.equals("ID"))
        {
          queryString = "SELECT * FROM EMPLOYEE WHERE EMP_ID='"+field+"'";
        }
        else
        {
          queryString = "SELECT * FROM EMPLOYEE WHERE EMP_IC='"+field+"'";
        }

        System.out.println(queryString);  
        ResultSet achieve = getResultSet(queryString);
        try {

            if (achieve.next()) {
                // Display result in a dialog box
                id_field.setText(achieve.getString("EMP_ID"));
                name_field.setText(achieve.getString("EMP_NAME"));
                ic_field.setText(achieve.getString("EMP_IC"));
                phone_field.setText(achieve.getString("EMP_PHONE"));
                email_field.setText(achieve.getString("EMP_EMAIL"));
                address_field.setText(achieve.getString("EMP_ADDRESS"));
                position_field.setText(achieve.getString("EMP_POSITION"));


                String date=achieve.getString("EMP_HIREDATE");
                String year=date.substring(0,4);
                String month=date.substring(5,7);
                String day=date.substring(8,10);
                hiredDate_field.setText(day+" / "+month+" / "+year);
                basicPay_field.setText(achieve.getString("EMP_PAY"));
                password_field.setText(achieve.getString("EMP_PW"));
                race_field.setText(achieve.getString("EMP_RACE"));
                religion_field.setText(achieve.getString("EMP_RELIGION"));
                status_field.setText(achieve.getString("EMP_STATUS"));
                find_field.setText("");

                id_field.setFocusable(false);
                name_field.setFocusable(false);
                ic_field.setFocusable(false);
                phone_field.setFocusable(false);
                email_field.setFocusable(false);
                address_field.setFocusable(false);
                position_field.setFocusable(false);
                hiredDate_field.setFocusable(false);
                basicPay_field.setFocusable(false);
                password_field.setFocusable(false);
                race_field.setFocusable(false);
                religion_field.setFocusable(false);
                status_field.setFocusable(false);
            }
            else
            {
                // Display result in a dialog box
                JOptionPane.showMessageDialog(null, "Identity not found !");
            }
        }
        catch (SQLException ex)
        {
            ex.printStackTrace();
        }

    }//GEN-LAST:event_find_buttonActionPerformed
//*-*-*-*-*-*-*-*-*-*-*-*-*-* END OF USER SEARCH PART *-*-*-*-*-*-*-*-*-*-*-*-*-*
    

    //************************** USER UPDATE PART ******************************
    private void find_button1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_find_button1ActionPerformed
        String field = find_field1.getText();
        String choice = selection1.getSelectedItem().toString();
        String queryString;
        if (choice.equals("ID"))
        {
          queryString = "SELECT * FROM EMPLOYEE WHERE EMP_ID='"+field+"'";
        }
        else
        {
          queryString = "SELECT * FROM EMPLOYEE WHERE EMP_IC='"+field+"'";
        }

        System.out.println(queryString);
        ResultSet achieve = getResultSet(queryString);
        try
        {

            if (achieve.next())
            {
                // Display result in a dialog box
                id_field1.setText(achieve.getString("EMP_ID"));
                //id_field1.setFocusable(false);
                name_field1.setText(achieve.getString("EMP_NAME"));
                ic_field1.setText(achieve.getString("EMP_IC"));
                phone_field1.setText(achieve.getString("EMP_PHONE"));
                email_field1.setText(achieve.getString("EMP_EMAIL"));
                address_field1.setText(achieve.getString("EMP_ADDRESS"));
                positionBox.setSelectedItem(achieve.getString("EMP_POSITION"));
             
                //**String dateOfHire = achieve.getString("EMP_HIREDATE");** testing date ********
                System.out.println("DATE-> "+achieve.getString("EMP_HIREDATE"));
                
                String dateOfHire = achieve.getString("EMP_HIREDATE");
                yearBox.setSelectedItem(dateOfHire.substring(0,4));
                String Month = dateOfHire.substring(5,7);
                if (Month.equals("01"))
                    monthBox.setSelectedItem("Jan");
                else if(Month.equals("02"))
                    monthBox.setSelectedItem("Feb");
                else if(Month.equals("03"))
                    monthBox.setSelectedItem("Mar");
                else if(Month.equals("04"))
                    monthBox.setSelectedItem("Apr");
                else if(Month.equals("05"))
                    monthBox.setSelectedItem("May");
                else if(Month.equals("06"))
                    monthBox.setSelectedItem("June");
                else if(Month.equals("07"))
                    monthBox.setSelectedItem("July");
                else if(Month.equals("08"))
                    monthBox.setSelectedItem("Aug");
                else if(Month.equals("09"))
                    monthBox.setSelectedItem("Sep");
                else if(Month.equals("10"))
                    monthBox.setSelectedItem("Oct");
                else if(Month.equals("11"))
                    monthBox.setSelectedItem("Nov");
                else
                    monthBox.setSelectedItem("Dec");

                dayBox.setSelectedItem(dateOfHire.substring(8,10));
        
                basicPay_field1.setText(achieve.getString("EMP_PAY"));
                password_field1.setText(achieve.getString("EMP_PW"));
                raceBox.setSelectedItem(achieve.getString("EMP_RACE"));
                religionBox.setSelectedItem(achieve.getString("EMP_RELIGION"));
                statusBox.setSelectedItem(achieve.getString("EMP_STATUS"));
            }
            else
            {
                // Display result in a dialog box   
                JOptionPane.showMessageDialog(null, "Identity not found !");
            }
        }
        catch (SQLException ex)
        {
            ex.printStackTrace();
        }
        
    }//GEN-LAST:event_find_button1ActionPerformed

    private void reset_button1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reset_button1ActionPerformed
        resetUpdate();
    }//GEN-LAST:event_reset_button1ActionPerformed

    private void saveUPDATEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveUPDATEActionPerformed
    
        if(find_field1.getText().equals(""))
        {
            JOptionPane.showMessageDialog(null,"No profile is selected !");
        }
        else
        {
            String ID=id_field1.getText();
            String NAME=name_field1.getText();
            String IC=ic_field1.getText();
            String PHONE=phone_field1.getText();
            String EMAIL=email_field1.getText();
            String ADDRESS=address_field1.getText();
            String POSITION=positionBox.getSelectedItem().toString();
            String day=dayBox.getSelectedItem().toString();
            String month=monthBox.getSelectedItem().toString();
            String year=yearBox.getSelectedItem().toString();
            String hiredate=day+month+year;
            String salary=basicPay_field1.getText();
            String PASSWORD=password_field1.getText();
            String RACE=raceBox.getSelectedItem().toString();
            String RELIGION=religionBox.getSelectedItem().toString();
            String STATUS=statusBox.getSelectedItem().toString();



            String updateQuery="UPDATE HR.EMPLOYEE SET EMP_ID='"+ID+"', EMP_NAME='"+NAME+"', EMP_IC='"+IC+"'," +
                "EMP_PHONE='"+PHONE+"', EMP_ADDRESS='"+ADDRESS+"', EMP_EMAIL='"+EMAIL+"', EMP_POSITION='"+POSITION+"',"
                + "EMP_HIREDATE='"+hiredate+"', EMP_PAY='"+salary+"', EMP_PW='"+PASSWORD+"',EMP_RACE='"+RACE+"',"
                + "EMP_RELIGION='"+RELIGION+"', EMP_STATUS='"+STATUS+"'"
                + " WHERE EMP_ID='"+ID+"'";

            System.out.println(updateQuery);
            String message = "Do you want to save the changes ?";
            String title1 = "Confirmation?";
            // display the JOptionPane showConfirmDialog
            int reply = JOptionPane.showConfirmDialog(null, message, title1, JOptionPane.YES_NO_OPTION);
            if (reply == JOptionPane.YES_OPTION)//save to database once the user click "YES"
            {
                System.out.print(updateQuery);
                updateRow(updateQuery);
                resetUpdate();
                JOptionPane.showMessageDialog(null, "Update successful.");
                /*connectDatabase();
                try
                {

                    stmt = con.createStatement();
                    stmt.executeUpdate(updateQuery);
                }
                catch (SQLException ex)
                {

                    Logger.getLogger(EMPLOYEE_PROFILE.class.getName()).log(Level.SEVERE, null, ex);
                }
                 */
            }
        }
    }//GEN-LAST:event_saveUPDATEActionPerformed
// *-*-*-*-*-*-*-*-*-*-*-*-*-* END OF USER UPDATE PART *-*-*-*-*-*-*-*-*-*-*-*-*-*


    //************************** USER ADD PART ******************************
    private void AddProfileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddProfileActionPerformed

        //String ID=id_field2.getText();
        String NAME=name_field2.getText();
        String IC=ic_field2.getText();
        String PHONE=phone_field2.getText();
        String EMAIL=email_field2.getText();
        String ADDRESS=address_field2.getText();
        String POSITION=positionBox2.getSelectedItem().toString();
        String day=dayBox2.getSelectedItem().toString();
        String month=monthBox2.getSelectedItem().toString();
        String year=yearBox2.getSelectedItem().toString();
        String hiredate=day+month+year;
        String salary=basicPay_field2.getText();
        String PASSWORD=password_field2.getText();
        String RACE=raceBox2.getSelectedItem().toString();
        String RELIGION=religionBox2.getSelectedItem().toString();
        String STATUS=statusBox2.getSelectedItem().toString();
/*
       String detectPW=password_field2.getText().toString();
       String query="SELECT EMP_PW FROM EMPLOYEE";
       try
       {
          ResultSet rset=getResultSet(query);
          while(rset.next())
          {
             if(rset.getString("EMP_PW").equals(detectPW))
             {
               JOptionPane.showMessageDialog(null,"This password has been used !");
               password_field2.setText("");
               break;
             }
           }
        }
        catch(Exception ex)
        {
          ex.fillInStackTrace();
        }
*/
        
        if(NAME.equals("") || IC.equals("") || PHONE.equals("") || EMAIL.equals("") ||
                ADDRESS.equals("") || salary.equals("") || password_field2.getText().equals("") )
        {
            JOptionPane.showMessageDialog(null,"Please make sure all the details are filled !");
        }
        else
        {

               

            String addQuery="INSERT INTO EMPLOYEE VALUES('"+temp_count+"','"+NAME+"','"+IC+"','"+PHONE+"'"
                    + ",'"+ADDRESS+"','"+EMAIL+"','"+POSITION+"','"+hiredate+"','"+salary+"','"+PASSWORD+"'"
                    + ",'"+RACE+"','"+RELIGION+"','"+STATUS+"')";

            String message = "Do you want to add a new detail ?";
            String TITLE = "Confirmation?";
            // display the JOptionPane showConfirmDialog
            int reply = JOptionPane.showConfirmDialog(null, message, TITLE, JOptionPane.YES_NO_OPTION);
            if (reply == JOptionPane.YES_OPTION)//save to database once the user click "YES"
            {

                System.out.print(addQuery);
                connectDatabase();
                try
                {
                    stmt = con.createStatement();
                    stmt.executeUpdate(addQuery);
                    JOptionPane.showMessageDialog(null, "Add successful.");
                }
                catch (SQLException ex)
                {
                    JOptionPane.showMessageDialog(null, "Add failed.\nDuplicate data is not allowed.");
                    //Logger.getLogger(EMPLOYEE_PROFILE.class.getName()).log(Level.SEVERE, null, ex);
                }
                resetAdd();
            }
        }
        
    }//GEN-LAST:event_AddProfileActionPerformed
// *-*-*-*-*-*-*-*-*-*-*-*-*-* END OF USER ADD PART *-*-*-*-*-*-*-*-*-*-*-*-*-*


    private void reset_button2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reset_button2ActionPerformed
        resetAdd();
    }//GEN-LAST:event_reset_button2ActionPerformed

    private void reset_button3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reset_button3ActionPerformed
        resetDelete();
    }//GEN-LAST:event_reset_button3ActionPerformed



    //************************** USER DELETE PART ******************************
    private void find_button3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_find_button3ActionPerformed
        String field = find_field3.getText();
        String choice = selection3.getSelectedItem().toString();
        String queryString;
        if (choice.equals("ID"))
        {
          queryString = "SELECT * FROM EMPLOYEE WHERE EMP_ID='"+field+"'";
        }
        else
        {
          queryString = "SELECT * FROM EMPLOYEE WHERE EMP_IC='"+field+"'";
        }

        System.out.println(queryString);
        ResultSet achieve = getResultSet(queryString);
        try
        {

            if (achieve.next())
            {
                // Display result in a dialog box
                id_field3.setText(achieve.getString("EMP_ID"));
                name_field3.setText(achieve.getString("EMP_NAME"));
                ic_field3.setText(achieve.getString("EMP_IC"));
                phone_field3.setText(achieve.getString("EMP_PHONE"));
                address_field3.setText(achieve.getString("EMP_ADDRESS"));
                email_field3.setText(achieve.getString("EMP_EMAIL"));
                position_field3.setText(achieve.getString("EMP_POSITION"));
                            
                String date=achieve.getString("EMP_HIREDATE");
                String year=date.substring(0,4);
                String month=date.substring(5,7);
                String day=date.substring(8,10);
                hiredDate_field3.setText(day+" / "+month+" / "+year);
                basicPay_field3.setText(achieve.getString("EMP_PAY"));
                password_field3.setText(achieve.getString("EMP_PW"));
                race_field3.setText(achieve.getString("EMP_RACE"));
                religion_field3.setText(achieve.getString("EMP_RELIGION"));
                status_field3.setText(achieve.getString("EMP_STATUS"));
               

                id_field3.setFocusable(false);
                name_field3.setFocusable(false);
                ic_field3.setFocusable(false);
                phone_field3.setFocusable(false);
                email_field3.setFocusable(false);
                address_field3.setFocusable(false);
                position_field3.setFocusable(false);
                hiredDate_field3.setFocusable(false);
                basicPay_field3.setFocusable(false);
                password_field3.setFocusable(false);
                race_field3.setFocusable(false);
                religion_field3.setFocusable(false);
                status_field3.setFocusable(false);
            }
            else
            {
                // Display result in a dialog box
                JOptionPane.showMessageDialog(null, "Identity not found !");
            }
        }
        catch (SQLException ex)
        {
            ex.printStackTrace();
        }

    }//GEN-LAST:event_find_button3ActionPerformed

    private void DELETE_BUTTONActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DELETE_BUTTONActionPerformed
        String field = find_field3.getText();
        String choice = selection3.getSelectedItem().toString();
        String deleteQuery="";
        if(field.equals(""))
        {
            JOptionPane.showMessageDialog(null,"Nothing to be deleted !");
        }
        else
        {
            if (choice.equals("ID"))
            {
              deleteQuery = "DELETE FROM EMPLOYEE WHERE EMP_ID='"+field+"'";
            }
            else
            {
              deleteQuery = "DELETE FROM EMPLOYEE WHERE EMP_IC='"+field+"'";
            }

            String message = "Are you sure want to delete this user profile ?";
            String title2 = "Confirmation?";
            // display the JOptionPane showConfirmDialog
            int reply = JOptionPane.showConfirmDialog(null, message, title2, JOptionPane.YES_NO_OPTION);
            if (reply == JOptionPane.YES_OPTION)//delete from database once the user click "YES"
            {
                System.out.print(deleteQuery);
                updateRow(deleteQuery);
                resetDelete();
                JOptionPane.showMessageDialog(null, "Delete successful.");
            }
            
        }
    }//GEN-LAST:event_DELETE_BUTTONActionPerformed
// *-*-*-*-*-*-*-*-*-*-*-*-*-* END OF USER DELETE PART *-*-*-*-*-*-*-*-*-*-*-*-*-*




    private void reset_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reset_buttonActionPerformed
        resetSearch();
    }//GEN-LAST:event_reset_buttonActionPerformed

    private void back_button2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_back_button2ActionPerformed
        this.setVisible(false);
        new EMPLOYEE_MENU().setVisible(true);
    }//GEN-LAST:event_back_button2ActionPerformed

    private void back_button3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_back_button3ActionPerformed
        this.setVisible(false);
        new EMPLOYEE_MENU().setVisible(true);
    }//GEN-LAST:event_back_button3ActionPerformed

    private void back_button4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_back_button4ActionPerformed
        this.setVisible(false);
        new EMPLOYEE_MENU().setVisible(true);
    }//GEN-LAST:event_back_button4ActionPerformed

    private void back_button5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_back_button5ActionPerformed
        this.setVisible(false);
        new EMPLOYEE_MENU().setVisible(true);
    }//GEN-LAST:event_back_button5ActionPerformed

    private void add_buttonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_add_buttonMouseClicked

        // TODO add your handling code here:
}//GEN-LAST:event_add_buttonMouseClicked

    private void add_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_add_buttonActionPerformed
        search_panel.setVisible(false);
        update_panel.setVisible(false);
        add_panel.setVisible(true);
        delete_panel.setVisible(false);
        L1.setVisible(false);
        L2.setVisible(false);
        L3.setVisible(true);
        L4.setVisible(false);
        L5.setVisible(false);
        resetSearch();
        resetUpdate();
        resetAdd();
        resetDelete();


        // GENERATE THE NEXT EMPLOYEE NUMBER TO BE
        String temp = "SELECT EMP_ID FROM EMPLOYEE WHERE EMP_ID >= ALL (SELECT EMP_ID FROM EMPLOYEE)";
        System.out.println(temp);
        ResultSet achieve = getResultSet(temp);
        try
        {

            if (achieve.next())
            {
                temp_count = achieve.getInt(1);
                temp_count = temp_count + 1;
                System.out.println(temp_count);
            }
        }
        catch (SQLException ex) {
            ex.printStackTrace();
        }
        id_field2.setText(temp_count+"");
}//GEN-LAST:event_add_buttonActionPerformed

    private void search_buttonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_search_buttonMouseClicked

        // TODO add your handling code here:
}//GEN-LAST:event_search_buttonMouseClicked

    private void search_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_search_buttonActionPerformed

        search_panel.setVisible(true);
        update_panel.setVisible(false);
        add_panel.setVisible(false);
        delete_panel.setVisible(false);
        L1.setVisible(true);
        L2.setVisible(false);
        L3.setVisible(false);
        L4.setVisible(false);
        L5.setVisible(false);
        resetSearch();
        resetUpdate();
        resetAdd();
        resetDelete();
}//GEN-LAST:event_search_buttonActionPerformed

    private void update_buttonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_update_buttonMouseClicked

}//GEN-LAST:event_update_buttonMouseClicked

    private void update_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_update_buttonActionPerformed
        search_panel.setVisible(false);
        update_panel.setVisible(true);
        add_panel.setVisible(false);
        delete_panel.setVisible(false);
        L1.setVisible(false);
        L2.setVisible(true);
        L3.setVisible(false);
        L4.setVisible(false);
        L5.setVisible(false);
        resetSearch();
        resetUpdate();
        resetAdd();
        resetDelete();
}//GEN-LAST:event_update_buttonActionPerformed

    private void delete_buttonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_delete_buttonMouseClicked

}//GEN-LAST:event_delete_buttonMouseClicked

    private void delete_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_delete_buttonActionPerformed
        search_panel.setVisible(false);
        update_panel.setVisible(false);
        add_panel.setVisible(false);
        delete_panel.setVisible(true);
        L1.setVisible(false);
        L2.setVisible(false);
        L3.setVisible(false);
        L4.setVisible(true);
        L5.setVisible(false);
        resetSearch();
        resetUpdate();
        resetAdd();
        resetDelete();
}//GEN-LAST:event_delete_buttonActionPerformed

    private void view_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_view_buttonActionPerformed

        this.setVisible(false);
        new EMPLOYEE_PROFILE2().setVisible(true);
}//GEN-LAST:event_view_buttonActionPerformed

    private void password_field2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_password_field2ActionPerformed

    }//GEN-LAST:event_password_field2ActionPerformed

    private void password_field2KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_password_field2KeyTyped

    }//GEN-LAST:event_password_field2KeyTyped

    private void password_field2MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_password_field2MouseExited
        String detectPW=password_field2.getText().toString();
       String query="SELECT EMP_PW FROM EMPLOYEE";
       try
       {
          ResultSet rset=getResultSet(query);
          while(rset.next())
          {
             if(rset.getString("EMP_PW").equals(detectPW))
             {
               JOptionPane.showMessageDialog(null,"This password has been used !");
               password_field2.setText("");
               break;
             }
           }
        }
        catch(Exception ex)
        {
          ex.fillInStackTrace();
        }
    }//GEN-LAST:event_password_field2MouseExited




    

    //reset all of the text field in Search Panel
    public void resetSearch()
    {
        id_field.setText("");
        name_field.setText("");
        ic_field.setText("");
        phone_field.setText("");
        email_field.setText("");
        address_field.setText("");
        position_field.setText("");
        hiredDate_field.setText("");
        basicPay_field.setText("");
        password_field.setText("");
        find_field.setText("");
        race_field.setText("");
        religion_field.setText("");
        status_field.setText("");
    }

    //reset all of the text field in the Update Panel
    public void resetUpdate()
    {
        id_field1.setText("");
        name_field1.setText("");
        ic_field1.setText("");
        phone_field1.setText("");
        email_field1.setText("");
        address_field1.setText("");
        positionBox.setSelectedItem(null);
        dayBox.setSelectedItem(null);
        monthBox.setSelectedItem(null);
        yearBox.setSelectedItem(null);
        basicPay_field1.setText("");
        password_field1.setText("");
        find_field1.setText("");
        raceBox.setSelectedItem(null);
        religionBox.setSelectedItem(null);
        statusBox.setSelectedItem(null);
    }

    //reset all of the text field in the Update Panel
    public void resetAdd()
    {
        id_field2.setText("");
        name_field2.setText("");
        ic_field2.setText("");
        phone_field2.setText("");
        email_field2.setText("");
        address_field2.setText("");
        positionBox2.setSelectedIndex(0);
        dayBox2.setSelectedItem("");
        monthBox2.setSelectedItem("");
        yearBox2.setSelectedItem("");
        basicPay_field2.setText("");
        password_field2.setText("");
        raceBox2.setSelectedIndex(3);
        religionBox2.setSelectedIndex(3);
        statusBox2.setSelectedIndex(1);
    }

    public void resetDelete()
    {
        id_field3.setText("");
        name_field3.setText("");
        ic_field3.setText("");
        phone_field3.setText("");
        email_field3.setText("");
        address_field3.setText("");
        position_field3.setText("");
        hiredDate_field3.setText("");
        basicPay_field3.setText("");
        password_field3.setText("");
        find_field3.setText("");
        race_field3.setText("");
        religion_field3.setText("");
        status_field3.setText("");
    }
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new EMPLOYEE_PROFILE().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton AddProfile;
    private javax.swing.JLabel Background;
    private javax.swing.JLabel BackgroundSearch;
    private javax.swing.JButton DELETE_BUTTON;
    private javax.swing.JLabel L1;
    private javax.swing.JLabel L2;
    private javax.swing.JLabel L3;
    private javax.swing.JLabel L4;
    private javax.swing.JLabel L5;
    private javax.swing.JLabel Wallpaper2;
    private javax.swing.JLabel Wallpaper3;
    private javax.swing.JLabel add;
    private javax.swing.JButton add_button;
    private javax.swing.JPanel add_panel;
    private javax.swing.JLabel address;
    private javax.swing.JLabel address1;
    private javax.swing.JLabel address2;
    private javax.swing.JLabel address3;
    private javax.swing.JTextField address_field;
    private javax.swing.JTextField address_field1;
    private javax.swing.JTextField address_field2;
    private javax.swing.JTextField address_field3;
    private javax.swing.JButton back_button2;
    private javax.swing.JButton back_button3;
    private javax.swing.JButton back_button4;
    private javax.swing.JButton back_button5;
    private javax.swing.JLabel basicPay;
    private javax.swing.JLabel basicPay1;
    private javax.swing.JLabel basicPay2;
    private javax.swing.JLabel basicPay3;
    private javax.swing.JTextField basicPay_field;
    private javax.swing.JTextField basicPay_field1;
    private javax.swing.JTextField basicPay_field2;
    private javax.swing.JTextField basicPay_field3;
    private javax.swing.JComboBox dayBox;
    private javax.swing.JComboBox dayBox2;
    private javax.swing.JLabel delete;
    private javax.swing.JButton delete_button;
    private javax.swing.JPanel delete_panel;
    private javax.swing.JLabel email;
    private javax.swing.JLabel email1;
    private javax.swing.JLabel email2;
    private javax.swing.JLabel email3;
    private javax.swing.JTextField email_field;
    private javax.swing.JTextField email_field1;
    private javax.swing.JTextField email_field2;
    private javax.swing.JTextField email_field3;
    private javax.swing.JButton find_button;
    private javax.swing.JButton find_button1;
    private javax.swing.JButton find_button3;
    private javax.swing.JTextField find_field;
    private javax.swing.JTextField find_field1;
    private javax.swing.JTextField find_field3;
    private javax.swing.JLabel hiredDate;
    private javax.swing.JLabel hiredDate1;
    private javax.swing.JLabel hiredDate2;
    private javax.swing.JLabel hiredDate3;
    private javax.swing.JTextField hiredDate_field;
    private javax.swing.JTextField hiredDate_field3;
    private javax.swing.JLabel ic;
    private javax.swing.JLabel ic1;
    private javax.swing.JLabel ic2;
    private javax.swing.JLabel ic3;
    private javax.swing.JTextField ic_field;
    private javax.swing.JTextField ic_field1;
    private javax.swing.JTextField ic_field2;
    private javax.swing.JTextField ic_field3;
    private javax.swing.JLabel id;
    private javax.swing.JLabel id1;
    private javax.swing.JLabel id2;
    private javax.swing.JLabel id3;
    private javax.swing.JLabel id_field;
    private javax.swing.JLabel id_field1;
    private javax.swing.JLabel id_field2;
    private javax.swing.JLabel id_field3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JSeparator jSeparator5;
    private javax.swing.JComboBox monthBox;
    private javax.swing.JComboBox monthBox2;
    private javax.swing.JLabel name;
    private javax.swing.JLabel name1;
    private javax.swing.JLabel name2;
    private javax.swing.JLabel name3;
    private javax.swing.JTextField name_field;
    private javax.swing.JTextField name_field1;
    private javax.swing.JTextField name_field2;
    private javax.swing.JTextField name_field3;
    private javax.swing.JPanel option_panel;
    private javax.swing.JLabel password;
    private javax.swing.JLabel password1;
    private javax.swing.JLabel password2;
    private javax.swing.JLabel password3;
    private javax.swing.JTextField password_field;
    private javax.swing.JTextField password_field1;
    private javax.swing.JTextField password_field2;
    private javax.swing.JTextField password_field3;
    private javax.swing.JLabel phone;
    private javax.swing.JLabel phone1;
    private javax.swing.JLabel phone2;
    private javax.swing.JLabel phone3;
    private javax.swing.JTextField phone_field;
    private javax.swing.JTextField phone_field1;
    private javax.swing.JTextField phone_field2;
    private javax.swing.JTextField phone_field3;
    private javax.swing.JLabel position;
    private javax.swing.JLabel position1;
    private javax.swing.JLabel position2;
    private javax.swing.JLabel position3;
    private javax.swing.JComboBox positionBox;
    private javax.swing.JComboBox positionBox2;
    private javax.swing.JTextField position_field;
    private javax.swing.JTextField position_field3;
    private javax.swing.JLabel race;
    private javax.swing.JLabel race1;
    private javax.swing.JLabel race2;
    private javax.swing.JLabel race3;
    private javax.swing.JComboBox raceBox;
    private javax.swing.JComboBox raceBox2;
    private javax.swing.JTextField race_field;
    private javax.swing.JTextField race_field3;
    private javax.swing.JLabel religion;
    private javax.swing.JLabel religion1;
    private javax.swing.JLabel religion2;
    private javax.swing.JLabel religion3;
    private javax.swing.JComboBox religionBox;
    private javax.swing.JComboBox religionBox2;
    private javax.swing.JTextField religion_field;
    private javax.swing.JTextField religion_field3;
    private javax.swing.JButton reset_button;
    private javax.swing.JButton reset_button1;
    private javax.swing.JButton reset_button2;
    private javax.swing.JButton reset_button3;
    private javax.swing.JButton saveUPDATE;
    private javax.swing.JLabel search;
    private javax.swing.JButton search_button;
    private javax.swing.JPanel search_panel;
    private javax.swing.JComboBox selection;
    private javax.swing.JComboBox selection1;
    private javax.swing.JComboBox selection3;
    private javax.swing.JLabel status;
    private javax.swing.JLabel status1;
    private javax.swing.JLabel status2;
    private javax.swing.JLabel status3;
    private javax.swing.JComboBox statusBox;
    private javax.swing.JComboBox statusBox2;
    private javax.swing.JTextField status_field;
    private javax.swing.JTextField status_field3;
    private javax.swing.JLabel title;
    private javax.swing.JLabel update;
    private javax.swing.JButton update_button;
    private javax.swing.JPanel update_panel;
    private javax.swing.JButton view_button;
    private javax.swing.JLabel wallpaper4;
    private javax.swing.JComboBox yearBox;
    private javax.swing.JComboBox yearBox2;
    // End of variables declaration//GEN-END:variables


}
